<!--{*
/*
 * This file is part of EC-CUBE
 *
 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
 *
 * http://www.lockon.co.jp/
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
*}-->
<script type="text/javascript">
<!--
// リストボックスのサイズ変更
function ChangeSize(button, TextArea, Max, Min, row_tmp){
	if(TextArea.rows <= Min){
		TextArea.rows=Max; button.value="小さくする"; row_tmp.value=Max;
	}else{
		TextArea.rows =Min; button.value="大きくする"; row_tmp.value=Min;
	}
}

// SQL確認画面起動
function doPreview(){
	document.form1.mode.value="preview"
	document.form1.target = "_blank";
	document.form1.submit();
}

// formのターゲットを自分に戻す
function fnTargetSelf(){
	document.form1.target = "_self";
}

//-->
</script>

<div id="alpha">
<div id="alpha-inner">
<!--▼SUB NAVI-->
<!--{include file=$tpl_subnavi}-->
<!--▲SUB NAVI-->
</div>
</div>



<div id="beta">
<div id="beta-inner">
<form name="form1" id="form1" method="post" action="<!--{$smarty.server.PHP_SELF|escape}-->">
<input type="hidden" name="mode" value="confirm">
<input type="hidden" name="sql_id" value="<!--{$sql_id}-->">
<input type="hidden" name="csv_output_id" value="">
<input type="hidden" name="selectTable" value="">

<div class="title_page">
<h2><!--{$tpl_subtitle}--></h2>
</div>



<!-- SQL一覧 ここから -->
<!--{ foreach key=key item=item from=$arrSqlList }-->
<h3>SQL一覧</h3>

<div class="menuclass">
<table summary="SQL一覧">
<tr>
	<td bgcolor="<!--{if $item.sql_id == $sql_id}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->">
	<a href="<!--{$smarty.server.PHP_SELF|escape}-->?sql_id=<!--{$item.sql_id}-->" ><!--{$item.sql_name}--></a>
	</td>
	<td bgcolor="<!--{if $item.sql_id == $sql_id}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->">
	<input type='button' value='CSV出力' name='csv' onclick="fnTargetSelf(); fnFormModeSubmit('form1','csv_output','csv_output_id',<!--{$item.sql_id}-->);"  />
	</td>
	<td bgcolor="<!--{if $item.sql_id == $sql_id}--><!--{$smarty.const.SELECT_RGB}--><!--{else}-->#ffffff<!--{/if}-->">
	<input type='button' value='削除' name='del' onclick="fnTargetSelf(); fnFormModeSubmit('form1','delete','sql_id',<!--{$item.sql_id}-->);"  />
	</td>
</tr>
</table>
</div>
<!--{ /foreach }-->



<div class="btn_box">
<input type='button' value='新規SQL作成' name='subm' onclick="fnTargetSelf(); fnFormModeSubmit('form1','new_page','','');" />
</div>
<!-- SQL一覧 ここまで -->



<!-- SQL設定 ここから -->
<h4>SQL設定</h4>

<div class="menuclass">
<dl>
<dt>名称<span class="red"> *</span></dt>
<dd>
	<span class="red12"><!--{$arrErr.sql_name}--></span>
	<input type="text" name="sql_name" value="<!--{$arrSqlData.sql_name|escape}-->" maxlength="<!--{$smarty.const.STEXT_LEN}-->" style="<!--{if $arrErr.name != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}--><!--{/if}-->" size="60" class="box60" />
	<span class="red"> （上限<!--{$smarty.const.STEXT_LEN}-->文字）</span>
</dd>

<dt>SQL文（SELECTは記述しないでください。）<span class="red"> *</span></dt>
<dd>
	<span class="red12"><!--{$arrErr.csv_sql}--></span>
	<div>
	<textarea name="csv_sql" cols=75 rows=30 align="left" wrap=off style="<!--{if $arrErr.csv_sql != ""}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}--> width: 547px;"><!--{$arrSqlData.csv_sql}--></textarea>
	</div>
</dd>
</dl>
</div>



<div class="btn_box">
<input type="submit" value="この内容で登録する" name="subm" onClick="mode.value='confirm'; fnTargetSelf();" />
<input type="submit" value="確認ページへ" name="subm" onClick="doPreview(); return false;" />
</div>
<!-- SQL設定 ここまで -->



<!-- DB一覧 ここから -->
<div class="menuclass">
<table summary="SQL出力設定">
<tr>
	<td width="50%">
	<div class="nodata2">
	<p>テーブル一覧</p>
	</div>
		<table summary="テーブル一覧">
		<tr>
			<td align="center">
			<select name="arrTableList[]" size="20" style="width:325px; height:300px;" onChange="mode.value=''; selectTable.value=this.value; submit();" onDblClick="csv_sql.value = csv_sql.value +' , ' + this.value;">
			<!--{html_options options=$arrTableList selected=$selectTable}-->
			</select>
			</td>
		</tr>
		</table>
	</td>
	<td width="50%">
	<div class="nodata2">
	<p>項目一覧</p>
	</div>
		<table summary="項目一覧">
		<tr>
			<td align="center">
			<select name="arrColList[]" size="20" style="width:325px; height:300px;" onDblClick="csv_sql.value = csv_sql.value +' , ' + this.value;">
			<!--{html_options options=$arrColList}-->
			</select>
			</td>
		</tr>
		</table>
	</td>
</tr>
</table>
</div>
<!-- DB一覧 ここまで -->


</form>
</script>
</div>
</div>
